package com.junzhiit.nengji.api.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.junzhiit.nengji.api.service.RechargeConfigureService;
import com.junzhiit.nengji.api.web.util.ViewObjectUtil;
import com.junzhiit.nengji.api.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.api.web.vo.RechargeConfigureVO;
import com.junzhiit.nengji.bo.RechargeConfigureBO;
import com.junzhiit.nengji.dao.RechargeConfigureDAO;
import com.junzhiit.nengji.model.RechargeConfigure;

@Service
public class RechargeConfigureServiceImpl extends BaseServiceImpl implements RechargeConfigureService {

	@Autowired
	private RechargeConfigureDAO rechargeConfigureDAO;
	
	@Override
	public Map<String, Object> findAll(RechargeConfigureVO vo, DataTablesParamVO dtp) {
		RechargeConfigureBO rechargeConfigure = new RechargeConfigureBO();
		BeanUtils.copyProperties(vo, rechargeConfigure);
		int totalCount = rechargeConfigureDAO.getTotalCount(rechargeConfigure);
		List<RechargeConfigure> list = rechargeConfigureDAO.findAll(rechargeConfigure, dtp.getStart(), dtp.getLength());
		
		return ViewObjectUtil.dataTables(list, dtp.getDraw(), totalCount);
	}

}
